#!/usr/bin/env python
# -*- coding:utf-8 -*-
# @Time : 2021-12-30 14:30
# @Author : huabao.tan
# @File : dbu_comm.py
# @Software: PyCharm

import pymysql
from dbutils.pooled_db import PooledDB

class PoolMysql:

    def __init__(self):
        self.pool = PooledDB(pymysql, 50, host=DB_HOST, port=DB_PORT, database=DB_NAME, user=DB_USER, password=DB_PASS)
        self.conn = self.pool.connection()
        self.cur = self.conn.cursor()



    def execute(self, sql):
        self.cur.execute()


    def comment(self):
        self.cur.comment()


    def close(self):
        self.conn.close()
        self.cur.closer()
